package main

import "math"

type Vector3 struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	Z float64 `json:"z"`
}

func GetAngle(v1 Vector3, v2 Vector3) (angel float64) {
	//求两向量夹角
	a := v1.X*v2.X + v1.Y*v2.Y + v1.Z*v2.Z
	b := math.Sqrt(math.Pow(v1.X, 2)+math.Pow(v1.Y, 2)+math.Pow(v1.Z, 2)) *
		math.Sqrt(math.Pow(v2.X, 2)+math.Pow(v2.Y, 2)+math.Pow(v2.Z, 2))
	angel = math.Acos(a / b)
	return
}
